//
//  ViewController.m
//  自定制collectionView动画
//
//  Created by MyMac on 15/9/18.
//  Copyright (c) 2015年 tongfang. All rights reserved.
//

#import "ViewController.h"
#import "CustomLayout.h"
#import "collcetionCell.h"
@interface ViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic,strong)NSMutableArray*dataArray;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.dataArray=[NSMutableArray array];
    CustomLayout*layout=[[CustomLayout alloc]init];
    layout.itemSize=CGSizeMake(150, 150);
    
    
    
    UICollectionView*collectionView=[[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout];
    collectionView.pagingEnabled=YES;
    collectionView.backgroundColor=[UIColor yellowColor];
    collectionView.delegate=self;
    collectionView.dataSource=self;
    [collectionView registerNib:[UINib nibWithNibName:@"collectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"cell"];
    [self.view addSubview:collectionView];
    
    
    
    
    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section;
{

    return 10;


}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
{
    return 1;

}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath;
{
    collcetionCell*cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    NSString*str=[NSString stringWithFormat:@"%ld.jpg",random()%3];
    cell.imageV.image=[UIImage imageNamed:str];
    return cell;




}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
